/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package py.com.domain;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 *
 * @author markos
 */
@Entity
@Table(name = "sector")
@NamedQueries({@NamedQuery(name = "Sector.findAll", query = "SELECT s FROM Sector s"), @NamedQuery(name = "Sector.findBySpSector", query = "SELECT s FROM Sector s WHERE s.spSector = :spSector"), @NamedQuery(name = "Sector.findBySpDescripcion", query = "SELECT s FROM Sector s WHERE s.spDescripcion = :spDescripcion"), @NamedQuery(name = "Sector.findBySpNombre", query = "SELECT s FROM Sector s WHERE s.spNombre = :spNombre"), @NamedQuery(name = "Sector.findBySpNumeroComisaria", query = "SELECT s FROM Sector s WHERE s.spNumeroComisaria = :spNumeroComisaria")})
public class Sector implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="sectorGen")
    @SequenceGenerator(sequenceName="sector_sp_sector_seq", name="sectorGen")
    @Basic(optional = false)
    @Column(name = "sp_sector")
    private Integer spSector;
    @Column(name = "sp_descripcion")
    private String spDescripcion;
    @Column(name = "sp_nombre")
    private String spNombre;
    @Column(name = "sp_numero_comisaria")
    private Integer spNumeroComisaria;
    @OneToMany(cascade = {CascadeType.MERGE, CascadeType.PERSIST}, mappedBy = "deSector", fetch = FetchType.EAGER)
    private List<Denuncias> denunciasList;

    public Sector() {
    }

    public Sector(Integer spSector) {
        this.spSector = spSector;
    }

    public Integer getSpSector() {
        return spSector;
    }

    public void setSpSector(Integer spSector) {
        this.spSector = spSector;
    }

    public String getSpDescripcion() {
        return spDescripcion;
    }

    public void setSpDescripcion(String spDescripcion) {
        this.spDescripcion = spDescripcion;
    }

    public String getSpNombre() {
        return spNombre;
    }

    public void setSpNombre(String spNombre) {
        this.spNombre = spNombre;
    }

    public Integer getSpNumeroComisaria() {
        return spNumeroComisaria;
    }

    public void setSpNumeroComisaria(Integer spNumeroComisaria) {
        this.spNumeroComisaria = spNumeroComisaria;
    }

    public List<Denuncias> getDenunciasList() {
        return denunciasList;
    }

    public void setDenunciasList(List<Denuncias> denunciasList) {
        this.denunciasList = denunciasList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (spSector != null ? spSector.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Sector)) {
            return false;
        }
        Sector other = (Sector) object;
        if ((this.spSector == null && other.spSector != null) || (this.spSector != null && !this.spSector.equals(other.spSector))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "py.com.domain.Sector[spSector=" + spSector + "]";
    }

}
